Repository navigation
Suggestion mode 4/9: inline marker primitive - #80430
Open
adamsilverstein wants to merge 102 commits into
Open
adamsilverstein wants to merge 102 commits into
adamsilverstein wants to merge 102 commits into
Conversation
Adds the generic inline-marker layer: wrap a rich-text range in a core/suggestion <mark>, find a marker's range by id, read the caret and selection in rich-text offset space, reconcile a marker after the user edits across it, and decorate markers via the annotations API. This is a self-contained rich-text utility with no suggestion-specific logic; the suggestion operations that build on it land in the next step.
This was referenced Jul 17, 2026
|
Size Change: 0 B Total Size: 7.93 MB |
adamsilverstein
marked this pull request as ready for review
August 5, 2026 22:24
Trunk switched @wordpress/dependency-group to 'never' mode, so the import group headers in these files now fail lint.
Rename the files this PR adds from .js to .ts and add types so the strict type check covers them. The marker id stays nullable in the public signatures because findMarkerRange/findMarkerText explicitly short-circuit on a missing id. No behavior changes.
|
Flaky tests detected in 5ca7f73. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/33117683339 Should save the changes in
|
# Conflicts: # packages/components/CHANGELOG.md
# Conflicts: # packages/editor/CHANGELOG.md
… them Typing inside a marker grows its range, so the ranges change on every keystroke. Clearing the source in the effect cleanup and adding every range back made two annotations store changes per keystroke, and each one re-runs the annotation selectors of every block and rich text. A range that only moved is now updated in place, and a changed set is replaced in one batch, so a keystroke costs one store change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018vwYjUxTyLPDe7HkXh9Zhk
…est/inline-markers
…est/inline-markers
`applyFormat` replaces any format of the same type in the range, so a second marker wrapped over another author's marker erased it. A later layer moved to adding the marker to each character's format stack; do that here, where the wrapper lands, and lint against the flattening rich-text helpers in the marker code. Claude-Session: https://claude.ai/code/session_018vwYjS1afuMwCEzNKqAxg6
The inline suggestion fixtures add about 196 KB of generated JSON under src/**/test. Exclude test directories from the published files, as media-editor, image-editor, theme and others already do.
…est/inline-markers
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #73411
What's in this PR
Adds the generic inline-marker layer, shared with Notes: wrap a rich-text range in a marker format, find a marker's range by id, read the caret and selection in rich-text offset space, reconcile a marker after the user edits across it, build the selector for a marker, and decorate markers via the annotations API.
It is format-agnostic. The caller passes its own format type and id attribute, so a note's marker and a suggestion's marker can sit on the same block. Offsets are never stored: a marker is found by id on every read, so it survives unrelated edits elsewhere in the text.
No suggestion-specific logic here; the suggestion formats and the operations that build on this land in the next step.
Diagram
This layer adds the marker primitive itself, so there is nothing to see in the UI yet. What it defines is the shape of a marker and the editor-only accessibility pass layered on top:
Testing
This is one layer of the stack. To exercise the whole feature, #78994 bundles every layer into one branch and builds it in Playground:
👉 https://playground.wordpress.net/gutenberg.html?pr=78994
Enable Gutenberg > Experiments > Collaboration > Suggestion Mode, then follow the walkthrough in #73411, which also explains how to review the stack layer by layer.
Suggestion mode stack
This rebuilds the manually-stacked Suggestion mode work (#73411) as a GitHub Stack of 9 small, independently reviewable PRs, each building on the one below it:
Each follow up fix now sits in the layer that owns the code it changes, rather than piling onto the top of the stack. Overlapping suggestions were briefly their own layer (#86206, now closed); that code sits in the layers that own it, mainly #80431 and #80433. The whole feature can be exercised end-to-end via the combined testing branch #78994 (Playground). Behind the "Suggestion Mode" experiment (Gutenberg > Experiments).
AI Use
Code and description both written with 🤖 Claude Code. I will review and test.